var yezhuKongjian=({
	loginout : function(){
		$.ajax({
			type : "POST",
			dataType : 'json',
			url : "../login/ljLogout.do",
			data : {
			},
			success : function(data) {
				if(data.resultCode==0){
					$$.toast("退出成功");
					storage.removeItem('flag');
					storage.removeItem('nickName');
					storage.removeItem('headimg');
					storage.removeItem('phone');
					window.location.href = "../jsp/login.html";
				}
			}
		});
	},getUserInfo : function (){
		$.ajax({
			type : "POST",
			dataType : 'json',
			url : "../user/isLogin.do",
			data : {
			},
			success : function(data) {
				if(data.success){
					
					var flag="";
					if(data.user.flag==0) flag="租客";
					if(data.user.flag==1) flag="房东";
					if(data.user.flag==2) flag="管家";
					if (data.user.nickName!=null) 
					{$("#name").html("").text(flag+data.user.nickName.substring(6,11));}
					if (data.user.headimg!=null)
					{$("#headimg").attr("src",data.user.headimg);}
					if(data.user!=null){
						$("#loginout").show();
					}
					if(data.user.flag==0){
						$("#myfoot").show();
					}
				}
			}
		});
		
	},
	toLink : function (txt,tagrt){
		$.ajax({
			type : "POST",
			dataType : 'json',
			url : "../user/isLogin.do",
			data : {
			},
			success : function(data) {
				if(data.success){
					document.location.href = "./" + txt;
				}else{
					 $$.alert(data.msg, function () {
				          window.location.href="./login.html?url="+encodeURIComponent(window.location.href);
				        });
				}
			}
		});
		
	},
})